package com.promote.algorithm;

/**
 * @ClassName RemoveElements
 * Description 移除链表元素
 * @Author LiZiHao
 * Date 2021/8/17 9:54
 * @Version 1.0
 **/
public class RemoveElements {

    public static ListNode removeElements(ListNode head, int val) {

        if (head == null) {
            return head;
        }
        head.next = removeElements(head.next,val);
        return head.val ==val ? head.next:head;
    }


    public class ListNode{
        int val;
        ListNode next;

        public ListNode(int x){
            val=x;
        }
    }

}
